
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<html>
<head>
    <title>商品列表</title>

    <!--导入boostrap的css文件-->
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css" rel="stylesheet" >
    <!--导入jquery文件-->
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script>
    <!--导入boostrap的js库-->
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>

</head>
<body>
<table  width="100%" class="table table-responsive table-bordered table-hover table-striped">
    <tr>
        <th>
            <input type="checkbox" />
        </th>
        <th>商品编号</th>
        <th>商品名</th>
        <th>商品单价</th>
        <th>商品类别</th>
        <a class="btn btn-primary" href="add.jsp">添加</a>

    </tr>
    <c
    <c:forEach items="${shops}" var="s">
        <tr>
            <td>
                <input type="checkbox" />
            </td>
            <td>${s.sid}</td>
            <td>${s.name}</td>
            <td>${s.sprice}</td>
            <td>${s.tid}</td>
            <td>
                <a class="btn btn-primary" href="${pageContext.request.contextPath}/findShopBySid?sid=${s.sid}">修改</a>
                <a href="javascript:void(0)" id="del" onclick="delUser('${s.sid}')" class="btn btn-danger">删除</a>

            </td>
        </tr>

    </c:forEach>

</table>




</body>
<script>
    //编写一个函数 原生js
    function  delUser(sid){
        var flag =  window.confirm("您确认删除吗?") ;
        //点击确认按钮,flag就是true ,点击取消按钮,false
        if(flag){
            //改变url地址
            // alert(uid) ;
            window.location.href="${pageContext.request.contextPath}/delete?sid="+sid;
        }

    }
</script>
</html>
